// https://www.luogu.com.cn/problem/P5727

#include <iostream>
#include <vector>
using namespace std;

int main() {
    long long n;
    scanf("%lld", &n);
    vector<long long> ans;
    ans.push_back(n);
    while (n > 1) {
        if (n & 1) {
            n = n * 3 + 1;
        } else {
            n /= 2;
        }
        ans.push_back(n);
    }

    for (int i=ans.size()-1; i>=0; i--) {
        printf("%lld ", ans[i]);
    }
    return 0;
}